package com.example.config;

import com.example.properties.TestProperties;
import com.example.util.ApplicationContextUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.File;
import java.time.LocalTime;

@Configuration
public class TestConfig {

    @Autowired
    private TestProperties testProperties;

    @Autowired
    ApplicationContextUtil applicationContextUtil;


    @Bean
    void init(){

        for (int i = 0; i < 4; i++) {
//            prototypeDemo.test();
            PrototypeDemo prototypeDemo=applicationContextUtil.getBean(PrototypeDemo.class);
            System.out.println(prototypeDemo.hashCode()+">>>>>>>>>"+this.toString());
        }

        String value1 = testProperties.getValue1();
        String value2 = testProperties.getValue2();
        LocalTime netStr = testProperties.getNetProperties().getNetStr();
        String neStr = testProperties.getNetP().getNeStr();
        System.out.println("value2 = " + value2);
        System.out.println("value1 = " + System.getProperty("user.dir")+ File.separator+value1);
    }
}
